package com.example.zhuma;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AnalyseActivity extends AppCompatActivity implements View.OnClickListener {
    //定义ListView要显示的情感标签信息
    private static final String[] qinggan1Array = {"烦躁", "烦躁", "烦躁", "烦躁"};
    private static final String[] qinggan2Array = {"焦虑", "焦虑", "焦虑", "焦虑"};
    //定义ListView要显示的情感等级信息
    private static final String[] qingganRankArray = {"5", "2", "4", "3"};
    //定义ListView要显示的时间信息
    private static final String[] timeArray = {"2023年12月12日8时56分", "2023年12月12日8时56分", "2023年12月12日8时56分", "2023年12月12日8时56分"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_analyse);
        //去除上方导航框
        if (getSupportActionBar() != null) {
            getSupportActionBar().hide();
        }
        ListView analyse_lv = findViewById(R.id.analyse_lv);
        //声明一个映射对象的列表，用于表示心理知识的icon、title和content
        List<Map<String, Object>> list = new ArrayList<>();
        for (int i = 0; i < timeArray.length; i++) {
            Map<String, Object> item = new HashMap<>();
            item.put("qinggan1", qinggan1Array[i]);
            item.put("qinggan2", qinggan2Array[i]);
            item.put("qingganRank", qingganRankArray[i]);
            item.put("time", timeArray[i]);
            list.add(item);
        }
        SimpleAdapter simpleAdapter = new SimpleAdapter(this, list, R.layout.activity_analyse_item
                , new String[]{"qinggan1", "qinggan2", "qingganRank", "time"}
                , new int[]{R.id.analyse_qinggan1_tv, R.id.analyse_qinggan2_tv, R.id.analyse_rank_tv, R.id.analyse_time_tv});
        analyse_lv.setAdapter(simpleAdapter);
        Button button = findViewById(R.id.analyse_checkdetail_btn);
//        button.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        intent.setClass(this,VoiceActivity.class);
        startActivity(intent);
    }
}